package cn.tedu.file;

import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;

/**
 * 找出里面的所有.java文件
 */
public class FileFilterDemo {
    public static void main(String[] args) {
        File file = new File("./src/main/java/cn/tedu/file/");

        FileFilter filter = new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().endsWith(".java");
            }
        };
        FileFilter filter1 = (pathname)-> pathname.getName().endsWith(".java");

        File[] files = file.listFiles(filter);

        System.out.println(Arrays.toString(files));
    }
}
